﻿@model shop.KichThuoc

@{
    ViewBag.Title = "Create";
}
<div id="content">
    <div id="content-header">
        <div id="breadcrumb">
            <a href="index.html" title="Go to Home" class="tip-bottom"><i class="icon-home"></i> Home</a>
            <a href="#" class="tip-bottom">Form elements</a>
            <a href="#" class="current">Common elements</a>
        </div>      
    </div>
    <div class="container-fluid">
        <div class="row-fluid">
            <div class="span12">
                <div class="widget-box">
                    <div class="widget-title">
                        <span class="icon">
                            <i class="icon-align-justify"></i>
                        </span>
                        <h5>Thêm sản phẩm</h5>
                    </div>
                    <div class="widget-content nopadding">
                        @using (Html.BeginForm("create", "size", FormMethod.Post, new { enctype = "multipart/form-data", @id = "formsanpham", @class = "form-horizontal" }))
                        {
                            @Html.AntiForgeryToken()
                            @Html.ValidationSummary(true)
                            <div class="control-group">
                                <label class="control-label">Tên size:</label>
                                <div class="controls">
                                    <input type="text" class="required span3" name="Size" placeholder="Nhập tên size" />
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label">Mã size:</label>
                                <div class="controls">
                                    <input id="MaKT" name="MaKT" type="text" class="required span3" placeholder="Nhận mã size" /><div id="errormasp"></div>                              
                                </div>
                            </div>                                                                           
                            <div class="form-actions">
                                <button id="them" type="submit" class="btn btn-success">Thêm</button>
                            </div>
                        }
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="row-fluid">
    <div id="footer" class="span12"> 2012 &copy; Marutii Admin. Brought to you by <a href="http://themedesigner.in">Themedesigner.in</a> </div>
</div>
<script src="~/Content/themes/maruti/js/jquery.min.js"></script>
<script src="~/Content/themes/maruti/js/jquery.ui.custom.js"></script>
<script src="~/Content/themes/maruti/js/bootstrap.min.js"></script>
<script src="~/Content/themes/maruti/js/bootstrap-colorpicker.js"></script>
<script src="~/Content/themes/maruti/js/bootstrap-datepicker.js"></script>
<script src="~/Content/themes/maruti/js/jquery.uniform.js"></script>
<script src="~/Content/themes/maruti/js/select2.min.js"></script>
<script src="~/Content/themes/maruti/js/maruti.js"></script>
<script src="~/Content/themes/maruti/js/maruti.form_common.js"></script>
<script src="~/Plugin/ckeditor/ckeditor.js"></script>
<script src="~/Content/js/jquery.validate.js"></script>
<script src="~/Content/js/localization/messages_vi.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('#formsanpham').validate({
            errorClass: "help-inline",
            errorElement:"span"
        });
    });
    $('#MaKT').blur(function () {
        var url = "/admin/size/checkmasize";
        var name = $('#MaKT').val();
        if(name !="" )
        {
            $.get(url, { input: name }, function (data) {
                if(data =="1")
                {
                    $('#errormasp').html("<span style='color:red;'> Mã size này đã được sử dụng.</span>");
                    $('#MaKT').css("border:solid 1px red;");
                }
                if(data=="0")
                {
                    $('#errormasp').html("<span style='color:greed;'>Bạn có thể sử dụng mã size này.</span>");
                    //$('#MaKT').css("border:solid 1px red;");
                }
            });
        }
    });
</script>